package com.barneyx.mshinfoplatform.entity.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum EPlatformType implements IEnum<String>  {
    WECHAT_H5(1,"WECHAT_H5"),
    WECHAT_MINIAPP(2,"WECHAT_MINIAPP"),
    H5(3,"H5"),
    PC_WEB(4,"PC_WEB"),
    ANDROID(5,"ANDROID");
    EPlatformType(int code, String value){
        this.code = code;
        this.value = value;
    }


    public static EPlatformType SearchIntByIdentification(int code){
        for (EPlatformType e: EPlatformType.values()){
            if(e.code==code){
                return e;
            }
        }
        return null;
    }

    public static EPlatformType StrToE(String code){
        for(EPlatformType e: EPlatformType.values()){
            if(e.value.equalsIgnoreCase(code)){
                return e;
            }
        }
        return null;
    }
    public static int SearchIntByIdentificationCode(EPlatformType identification){
       return identification.code;
    }

    @EnumValue
    private final  int code;
    @JsonValue
    private final  String value;
}
